﻿using System.Collections.Generic;

namespace DatabaseGroup.SSIS.SourceAdapters.View
{
    /// <summary>
    /// Stores values related to the controls of the Editor's Error tab
    /// </summary>
    public class ErrorTabSettings : ITabSettings
    {
        private List<ColumnProperty> _columns;

        /// <summary>
        /// Gets or sets the truncation handling for the component
        /// </summary>
        public string ComponentTruncationHandling { get; set; }

        /// <summary>
        /// Gets or sets the error handling for the component
        /// </summary>
        public string ComponentErrorHandling { get; set; }

        /// <summary>
        /// Gets or sets the value for the error handling to apply to grid view cells
        /// </summary>
        public string ApplyHandling { get; set; }

        /// <summary>
        /// Gets or sets the list of standard output columns
        /// </summary>
        public List<ColumnProperty> Columns {
            get
            {
                if (_columns == null)
                    return null;

                // restrict to standard output columns only
                return _columns.FindAll((column) => column.IsForOutput);
            }
            set 
            {
                _columns = value;
            }
        }
    }
}
